package net.ljh.controller;

import net.ljh.bean.Websiteinfo;
import net.ljh.service.WebinfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class WebinfoController {

    @Autowired
    WebinfoService webinfoService;

    @RequestMapping("/admin/showWebsiteInfo")
    public String showinfo(Model model){
        Websiteinfo websiteinfo=webinfoService.find(1);
        System.out.println("websiteinfo1"+websiteinfo);
        model.addAttribute("websiteinfo",websiteinfo);
        return "admin/websiteinfo";

    }

    @RequestMapping("/admin/updateWebsiteInfo")
    public String updateinfo(Websiteinfo websiteinfo,Model model){
        webinfoService.update(websiteinfo);
        System.out.println("websiteinfo2"+websiteinfo);
        model.addAttribute(websiteinfo);
        return "admin/websiteinfo";
    }
}
